<!doctype html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->
<!--[if IE 7]>    <html class="no-js lt-ie9 lt-ie8" lang="en"> <![endif]-->
<!--[if IE 8]>    <html class="no-js lt-ie9" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<head>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<title>Installation check, BicBucStriim</title>
	<meta name="viewport" content="width=device-width,initial-scale=1">
  <link rel="stylesheet" href="style/jquery/jquery.mobile-1.4.5.min.css">
  <link rel="stylesheet" href="style/style.css">
  <link rel="icon" href="favicon.ico" type="image/x-icon">
	<script src="js/libs/modernizr-2.6.2-custom.min.js"></script>
</head>
<body>
  <!--[if lt IE 7]><p class=chromeframe>Your browser is <em>ancient!</em> <a href="http://browsehappy.com/">Upgrade to a different browser</a> or <a href="http://www.google.com/chromeframe/?redirect=true">install Google Chrome Frame</a> to experience this site.</p><![endif]-->

  
  <div data-role="page" data-title="{{ page.title }}" {% block pid %}{% endblock %}>
    <div data-role="header" data-position="inline">                  
      <h1>Installation check</h1>
    </div>
    <div data-role="content">      
      <h2>Explanation</h2>
      <p>
        This page executes various checks regarding the environment and the installation 
        directory of BicBucStriim. It checks for typical problems that users had in the 
        past. The checks signal the outcome with a traffic light scheme:
      </p>
      <table>
        <tr>
          <td><img src="img/bbs-light-green.png" width="32"/></td>
          <td>Everything ok.</td>
        </tr>
        <tr>
          <td><img src="img/bbs-light-yellow.png" width="32"/></td>
          <td>There could be a problem, click on the info button to see if it concerns you.</td>
        </tr>
        <tr>
          <td><img src="img/bbs-light-red.png" width="32"/></td>
          <td>A problem was discovered, please click on the info button to find out more.</td>
        </tr>
      </table>
      <hr/>
      <h2>Calibre library check</h2>
      <p>
        Enter the path to your Calibre library to check accessibility. A Calibre 
        library directory contains the file <em>metadata.db</em> plus various subdirectories 
        for authors and books.
      </p>
      <p>
        The test tries to find <em>metadata.db</em> in the directory you enter, 
        and will check if that directory is readable for the application. 
      </p>
      <p>
        If the test fails (red light), check:
        <ul>
          <li>that the directory really exists</li>
          <li>that it contains the files mentioned above</li>
          <li>
            that it is readable for the application 
            (see also the <em>open_basedir</em> check below)
          </li>
        </ul>
      </p>
      <table>
        <tr>
          <td class="80column">
            {% if cd.status == 0 %}
              &nbsp;
            {% else %}
              {% if cd.status == 1 %}
                <img src="img/bbs-light-green.png" />
              {% else %}
                <img src="img/bbs-light-red.png" />                
              {% endif %}
            {% endif %}              
          </td>
          <td>
            <form action="installcheck.php" method="post" id="calibrecheckform">
              <fieldset data-role="fieldcontain">
                <label for="calibre_dir">Calibre directory</label>
                <input name="calibre_dir" id="calibre_dir" type="text" 
                  value="{{calibre_dir}}" placeholder="Example: /volume1/books" />
              </fieldset>
              <button type="submit">Check</button> 
            </form>
          </td>
        </tr>
      {% if cd.status == 2 %}
        <tr>
          <td colspan="2">
            <ul>
            <li>Directory exists? {% if cd.dir_exists %}Yes{%else%}No{%endif%}</li>
            <li>Directory is readable? {% if cd.dir_is_readable %}Yes{%else%}No{%endif%}</li>
            <li>Directory is executable? {% if cd.dir_is_executable %}Yes{%else%}No{%endif%}</li>
            <li>Real path of database is: {{ cd.realpath }}</li>
            <li>Database opened? {% if cd.library_ok %}Yes{%else%}No{%endif%}</li>
            </ul>
          </td>
        </tr>
      {% endif %}
      </table>
      <hr/>
      <h2>Environment checks</h2>
      <ul data-role="listview" data-split-icon="info" data-inset="true"> 
        <li>
          <a href="#">
            {% if is_a == true %}
              <img src="img/bbs-light-green.png" />
            {% else %}
              <img src="img/bbs-light-yellow.png" />
            {%endif%}
            <h3>Apache web server?</h3>
            <p>
            {% if is_a == true %}Yes, {{srv}}.{% else %}No.{%endif%}
            </p>
          </a>
          <a href="#popupApache" data-rel="popup">
            info
          </a>
        </li>
        <li>
          <a href="#">
            {% if php == true %}
              <img src="img/bbs-light-green.png" align="center"/>
            {% else %}
              <img src="img/bbs-light-red.png" />
            {%endif%}
            <h3>
              PHP version 5.3+?
            </h3>
            <p>
            {% if php == true %}
                Yes, found version {{phpv}}.
            {% else %}
                No, found version {{phpv}}.
            {%endif%}
            </p>
          </a>
          <a href="#popupPhp" data-rel="popup">
            info
          </a>
        </li>
        <li>
          <a href="#">
            {% if htaccess == true %}
              <img src="img/bbs-light-green.png" />            
            {% else %}
              {% if is_a == true %}
                <img src="img/bbs-light-red.png" />
              {% else %}
                <img src="img/bbs-light-yellow.png" />
              {% endif %}
            {% endif %}  
            <h3>            
              Does <em>.htaccess</em> exist?
            </h3>
            <p>
              {% if htaccess == true %}
                Yes.
              {% else %}
                {% if is_a == true %}
                  No.
                {% else %}
                  No Apache, please ensure URL rewriting manually.
                {% endif %}
              {% endif %}  
            </p>
          </a>
          <a href="#popupHtaccess" data-rel="popup">
            info
          </a>
        </li>
        <li>
          <a href="#">
            {% if mre == true %}
              <img src="img/bbs-light-green.png" />            
            {% else %}
              {% if is_a == true %}
                <img src="img/bbs-light-red.png" />
              {% else %}
                <img src="img/bbs-light-yellow.png" />
              {% endif %}
            {% endif %}  
            <h3>            
              Is URL rewriting enabled?
            </h3>
            <p>
              {% if mre == true %}
                  Yes.
              {% else %}
                {% if is_a == true %}
                    No.
                {% else %}
                    No Apache, please verify manually.
                {% endif %}
              {% endif %}  
            </p>
          </a>
          <a href="#popupUrlRewrite" data-rel="popup">
            info
          </a>
        </li>
        <li>
          <a href="#">
            {% if hsql != false %}
              <img src="img/bbs-light-green.png" />
            {% else %}
              <img src="img/bbs-light-red.png" />
            {% endif %}
            <h3>            
              Is Sqlite3 installed?
            </h3>
            <p>
            {% if hsql != false %}
                Yes.
            {% else %}
                No.
            {% endif %}
            </p>
          </a>
          <a href="#popupSqlite3" data-rel="popup">
              info
           </a>
        </li>          
        <li>
          <a href="#">
            {% if hgd2 == true %}
              <img src="img/bbs-light-green.png" />
            {% else %}
              <img src="img/bbs-light-red.png" />
            {% endif %}
            <h3>            
              Is GD version 2 (or higher) installed?
            </h3>
            <p>
            {% if hgd2 == true %}
                Yes, found version {{hgd2v}}.
            {% else %}
              {% if hgd2v == "" %}
                No.
              {% else %}
                No, found {{hgd2v}}.
              {% endif %}
            {% endif %}          
            </p>
          </a>
          <a href="#popupGD2" data-rel="popup">
            info
          </a>
        </li>                  
        <li>
          <a href="#">
            {% if mcrypt == true %}
              <img src="img/bbs-light-green.png" />
            {% else %}
              <img src="img/bbs-light-yellow.png" />
            {% endif %}
            <h3>            
              Is Mcrypt enabled?
            </h3>
            <p>
            {% if mcrypt == true %}
                Yes.
            {% else %}            
                No.
            {% endif %}  
            </p>
          </a>
          <a href="#popupMcrypt" data-rel="popup">
            info
          </a>
        </li>
        <li>
          <a href="#">
            {% if intl == true %}
              <img src="img/bbs-light-green.png" />            
            {% else %}            
              <img src="img/bbs-light-yellow.png" />
            {% endif %}  
            <h3>            
              Is PHP module <em>intl</em> enabled?
            </h3>
            <p>
              {% if intl == true %}
                  Yes.
              {% else %}            
                  No.
              {% endif %}  
            </p>
          </a>
          <a href="#popupIntl" data-rel="popup">
            info
          </a>
        </li>        
        <li>
          <a href="#"> 
            {% if opd == "" %}
              <img src="img/bbs-light-green.png" />            
            {% else %}
              <img src="img/bbs-light-yellow.png" />            
            {% endif %}
            <h3>            
              Is the <em>open_basedir</em> restriction in effect? 
            </h3>
            <p>
              {% if opd == "" %}
                  No.                                          
              {% else %}
                  Yes, open_basedir = {{opd}}               
              {% endif %}
            </p>
          </a>
          <a href="#popupOPD" data-rel="popup">
            info
          </a>
        </li>                
        <li>
          <a href="#">
            {% if dwrit == true %}
              <img src="img/bbs-light-green.png" />            
            {% else %}
              <img src="img/bbs-light-red.png" />            
            {% endif %}
            <h3>            
              Is the <em>data</em> directory writeable?
            </h3>
            <p>
              {% if dwrit == true %}
                  Yes.
              {% else %}
                  No.
              {% endif %}
            </p>
          </a>
          <a href="#popupDataDir" data-rel="popup">
            info
          </a>
        </li>        
        <li>
          <a href="#">
            {% if mwrit == true %}
              <img src="img/bbs-light-green.png" />
            {% else %}
              <img src="img/bbs-light-red.png" />
            {% endif %}                    
            <h3>
              Is <em>data/data.db</em> writeable?
            </h3>
            <p>
            {% if mwrit == true %}
                Yes.
            {% else %}
                No.
            {% endif %}            
            </p>            
          </a>        
          <a href="#popupDataDb" data-rel="popup">
            info
          </a>          
        </li>        
      </ul>
    </div>
    <div data-role="footer" class="footer">
      {% include "footer.html" %}
    </div>  
    <div id="popupOPD" data-role="popup" data-theme="a">
      <p>
        The PHP <em>open_basedir</em> setting is a security measure that restricts file access for
        PHP applications to a list of specified directories mentioned in the variable. Many 
        NAS devices use this setting. 
      </p>
      <p>
        If your Calibre library is located outside your web server root, this directory should be included in 
        the open_basedir list. To include it, just append the name of your 
        Calibre directory to this list, e.g. <code>...:/volume1/books</code> (don't forget the colon in front).
      </p>
    </div>
    <div id="popupHtaccess" data-role="popup" data-theme="a">
      <p>
        BicBucStriim contains a <em>.htaccess</em> file that enables <em>URL rewriting</em>
        on Apache servers automatically. If the check failed this is probably due to 
        an unpack problem. Sometime unzippers don't unpack hidden files (i.e. files 
        whose names start with a dot) properly. Try a different unzip application.        
      </p>
    </div>    
    <div id="popupUrlRewrite" data-role="popup" data-theme="a">
      <p>
        BicBucStriim contains a <em>.htaccess</em> file that enables <em>URL rewriting</em>
        on Apache servers automatically. If this is an Apache web server and the check failed, 
        please change the URL rewriting (mod_rewrite) settings of your server/device. 
      </p>
      <p>
        If this is no Apache web server, you have to verify manually that URL 
        rewriting is enabled.
      </p>
    </div>
    <div id="popupSqlite3" data-role="popup" data-theme="a">
      <p>
        The Sqlite3 database library is required to read the Calibre library data. 
        Sqlite support for PHP is often contained in a module like <em>php5-sqlite</em>.
        Please install the Sqlite3 support if the check failed. 
      </p>
    </div>
    <div id="popupGD2" data-role="popup" data-theme="a">
      <p>
         The GD image library is necessary for thumbnail generation. 
         GD support for PHP is often contained in a module like <em>php5-gd</em>. 
         Please install or update the module if the check failed.
      </p>
    </div>
    <div id="popupMcrypt" data-role="popup" data-theme="a">
      <p>
        Mcrypt is used by the underlying framework to encrypt browser cookies. BicBucStriim works 
        without it, but then might transmit data unencrypted. In a secure home network 
        this is usually not a problem.
      </p>
      <p>
        In case you are using BicBucStriim in a public network, you might consider 
        enabling mcrypt to protect your cookies. In order to enable mcrypt, install
        a module like <em>php5-mcrypt</em>.
      </p>
    </div>
    <div id="popupIntl" data-role="popup" data-theme="a">
      <p>
        PHP module <em>intl</em> is used for translation and localization purposes. BicBucStriim works 
        without it, but then some data, like the language of a book, will not be displayed.
      </p>
      <p>
        In order to enable <em>intl</em>, install the PHP module, probably called <em>php5-intl</em>.
      </p>
    </div>    
    <div id="popupDataDir" data-role="popup" data-theme="a">
      <p>
        The <em>bbs/data</em> directory contains the configuration database and thumbnails.
        If it doesn't exist or is not writeable the application can't store anything. If the 
        check failed, please create the directory and/or change the access rights.
      </p>
    </div>
    <div id="popupDataDb" data-role="popup" data-theme="a">
      <p>
        The file <em>bbs/data/data.db</em> is part of the BicBucStriim package and stores your configuration data. 
        If the check failed, please verify that it exists and is writeable.
      </p>      
    </div>
    <div id="popupPhp" data-role="popup" data-theme="a">
      <p>
        BicBucStriim requires PHP 5.3 or higher. Otherwise some functions might fail.
      </p>
    </div>
    <div id="popupApache" data-role="popup" data-theme="a">
      <p>
        BicBucStriim works with Apache and other web servers. However, the 
        included configuration file <em>.htaccess</em> is for Apache only. If you are 
        using a different web server please make sure that features like  
        <em>URL rewriting</em> are enabled.
      </p>
    </div>    
  </div> <!-- page -->

  <script src="js/libs/jquery-1.11.1.min.js"></script>
  <script src="js/libs/jquery.mobile-1.4.5.min.js"></script>
</body>
</html>
